import gdata.projecthosting.client
import gdata.projecthosting.data
import gdata.gauth
import gdata.client
import gdata.data
import atom.http_core
import atom.core
 
class issue_monger(gdata.projecthosting.client.ProjectHostingClient):
  """Manipulate issues in a Google code hosted project.
  
  im = issue_monger()
  im.login(<username>, <password>)
  q = im.query(label='Project-TD3')
  f = im.issues(q)  # no q means retrieve all issues
  for i in f.entry:
    print i.title.text

  See http://code.google.com/p/support/wiki/IssueTrackerAPIPython.
  """

  app = 'cedu-issuemonger-1'
  proj = 'education-data-ma'

  def login(self, username, password):
    self.ClientLogin(username, password, self.app, 'code')

  def query(self, **named_args):
    return gdata.projecthosting.client.Query(**named_args)

  def issues(self, query=None):
    if query == None:
      query = gdata.projecthosting.client.Query(max_results='999')
    return self.get_issues(self.proj, query=query)
